package com.xqb.modules.controller.media;

import com.xqb.common.core.domain.AjaxResult;
import com.xqb.modules.service.MediaVodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: JinChen Zhu
 * @CreateTime: 2024-11-01  16:45
 */
@RestController
@RequestMapping("/media/vod")
public class MediaVodController {
    @Autowired
    private MediaVodService mediaVodService;

    @PostMapping("/upload")
    public AjaxResult upload() {
        String fileId = mediaVodService.uploadVideo();
        return AjaxResult.success(fileId);
    }

    /**
     * 删除视频
     */
    @DeleteMapping("/delete/{fileId}")
    public AjaxResult delete(@PathVariable String fileId) {
        mediaVodService.deleteVideo(fileId);
        return AjaxResult.success();
    }
}
